package ldh.im.fxbase.data.pojo.status;

import ldh.rpc.dto.ValueEnum;

public enum ImLoginType implements ValueEnum<Byte> {
    Password(1, "密码"),                 // 密码
    Token(2, "无秘"),                    // 无秘
    SlidePassword(3, "滑动密码"),         // 滑动密码
    Scan(4, "扫码"),                     // 扫码
    ;

    private Byte value;
    private String desc;

    private ImLoginType(Integer value, String desc){
        this.value = value.byteValue();
        this.desc = desc;
    }

    @Override
    public Byte getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    public static ImLoginType getByValue(Integer value) {
        if (value == null) return null;
        for (ImLoginType loginType : ImLoginType.values()) {
            if (loginType.getValue() == value.byteValue()) {
                return loginType;
            }
        }

        throw new RuntimeException("ImLoginType不支持这个值：" + value);
    }
}
